package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanhua.dubbo.mappers.QuestionUserLockMapper;
import com.tanhua.model.domain.QuestionUserLock;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author fff
 * @date 2021/12/13 15:52
 **/
@DubboService
public class QuestionUserLockApiImpl implements QuestionUserLockApi{
    @Autowired
    private QuestionUserLockMapper questionUserLockMapper;

    @Override
    public QuestionUserLock findUserLock(Long userId, String id) {
        LambdaQueryWrapper<QuestionUserLock> qw = new LambdaQueryWrapper<>();
        qw.eq(QuestionUserLock::getUserId,userId).eq(QuestionUserLock::getQuestionnaireId,id);
        return questionUserLockMapper.selectOne(qw);
    }

    @Override
    public void update(QuestionUserLock lock) {
        questionUserLockMapper.updateById(lock);
    }
}
